import time

import pytest
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService, Service
from selenium import webdriver
# from webdriver_manager.chrome import ChromeDriverManager


@pytest.fixture(scope='function',autouse=True)
def driver():
    # opthions = webdriver.ChromeOptions(s)
    # opthions.add_argument('-ignore-certificate-errors')
    # chrome = webdriver.Chrome(opthions=opthions)
    # chrome = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))

    driver = webdriver.Chrome()
    # driver = webdriver.Chrome()
    # driver.get("www.jd.com")
    driver.maximize_window()
    # driver.implicitly_wait(5)


# @pytest.fixture(scope='function',autouse=True)
# def driver():
    # options = webdriver.ChromeOptions()
    # options = Options()
    # options.add_argument('-ignore-certificate-errors')
    # options.debugger_address = "127.0.0.1:9222"
    # driver = webdriver.Chrome(options=options)
    # driver = webdriver.Chrome()
    # driver.maximize_window()
    return driver
    # yield driver
    # driver.quit()
    # def close_driver():
    #     chrome.close()
    # request.addfinalizer(close_driver)
    # return chrome

if __name__ == '__main__':
    driver()